package com.kexio.enterprise.integration.message.history;

import com.kexio.enterprise.integration.message.domain.Message;
import com.kexio.enterprise.integration.message.enums.MessageStatus;

import java.time.LocalDateTime;
import java.util.Map;

/**
 * 消息历史记录
 * 
 * @author Kexio
 * @since 1.0.0
 */
public class MessageHistory {
    private String historyId;
    private String messageId;
    private Message originalMessage;
    private MessageStatus status;
    private String providerId;
    private int retryCount;
    private LocalDateTime createTime;
    private LocalDateTime lastUpdateTime;
    private LocalDateTime deliveryTime;
    private String errorMessage;
    private Map<String, Object> deliveryDetails;

    public MessageHistory() {
        this.historyId = java.util.UUID.randomUUID().toString();
        this.createTime = LocalDateTime.now();
        this.retryCount = 0;
    }

    // Getters and Setters
    public String getHistoryId() { return historyId; }
    public void setHistoryId(String historyId) { this.historyId = historyId; }
    
    public String getMessageId() { return messageId; }
    public void setMessageId(String messageId) { this.messageId = messageId; }
    
    public Message getOriginalMessage() { return originalMessage; }
    public void setOriginalMessage(Message originalMessage) { this.originalMessage = originalMessage; }
    
    public MessageStatus getStatus() { return status; }
    public void setStatus(MessageStatus status) { this.status = status; }
    
    public String getProviderId() { return providerId; }
    public void setProviderId(String providerId) { this.providerId = providerId; }
    
    public int getRetryCount() { return retryCount; }
    public void setRetryCount(int retryCount) { this.retryCount = retryCount; }
    
    public LocalDateTime getCreateTime() { return createTime; }
    public void setCreateTime(LocalDateTime createTime) { this.createTime = createTime; }
    
    public LocalDateTime getLastUpdateTime() { return lastUpdateTime; }
    public void setLastUpdateTime(LocalDateTime lastUpdateTime) { this.lastUpdateTime = lastUpdateTime; }
    
    public LocalDateTime getDeliveryTime() { return deliveryTime; }
    public void setDeliveryTime(LocalDateTime deliveryTime) { this.deliveryTime = deliveryTime; }
    
    public String getErrorMessage() { return errorMessage; }
    public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; }
    
    public Map<String, Object> getDeliveryDetails() { return deliveryDetails; }
    public void setDeliveryDetails(Map<String, Object> deliveryDetails) { this.deliveryDetails = deliveryDetails; }
}
